import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/user',
    name: 'UserInterface',
    redirect: '/user/login',
    component: () => import('../views/UserInterface'),
    children: [
      {
        path: '/user/login',
        name: 'Login',
        component: () => import('../components/user_tools/Login')
      },
      {
        path: '/user/register',
        name: 'Register',
        component: () => import('../components/user_tools/Register')
      },
      {
        path: '/user/forget',
        name: 'ForgetPwd',
        component: () => import('../components/user_tools/ForgetPwd')
      }
    ]
  },
  {
    path: '/index',
    name: 'Index',
    redirect: '/index/profile',
    component: () => import('../views/Index'),
    children: [
      {
        path: '/index/patientlist',
        name: 'PatientList',
        component: () => import('../components/PatientList')
      },
      {
        path: '/index/profile',
        name: 'Profile',
        component: () => import('../components/Profile')
      },
      {
        path: '/index/test',
        name: 'Test',
        component: () => import('../components/test')
      },
      {
        path:'/index/patientInfo/:id',
        name:'PatientInfo',
        component:() => import('../components/PatientInfo')
      },
      {
        path: '/index/medicalRecord/:id',
        name: 'MedicalRecord',
        component: () => import('../components/MedicalRecord')
      },
      {
        path: '/index/detection',
        // name: 'Detection',
        component: () => import('../components/Detection'),
        children: [
          {
            path: '',
            name: 'Helper0',
            redirect: '/index/detection/helper'
          },
          {
            path: '/index/detection/helper',
            name: 'Helper',
            component: () => import('../components/DetectionHelper')
          },
          {
            path: '/index/detection/upload',
            name: 'Upload',
            component: () => import('../components/DetectionUpload')
          },
          {
            path: '/index/detection/report',
            name: 'Report',
            component: () => import('../components/DetectionReport')
          }
        ]
      }
    ]
  }
];

const router = new VueRouter({
  routes,
  mode: 'history'
});

export default router
